package ck.android.englishschool;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;


public abstract class BaseFragment extends Fragment {
	
	
	protected BaseActivity getBaseActivity(){
		FragmentActivity fragment = getActivity();
	    return (BaseActivity) fragment;	    
	}	
	
	public void addFragmentReplace(int layoutId, BaseFragment baseFragment, String name) {
		MenuControl.tagetFragment = baseFragment;
		//clearBackStack();
		FragmentTransaction ft = getFragmentManager().beginTransaction();
		ft.replace(layoutId, baseFragment, name);
		ft.commit();			
	}	
	public void clearBackStack(){
		FragmentManager fragmentManager = getFragmentManager();
		fragmentManager.popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
	}
	
	abstract public void Onback();
	
}
